At present, perhaps video games are the most commonly known form of computer graphics apparatus. However, the field embraces many other systems as for use in training, design, entertainment, modeling and so on. Typically, the systems give the viewer the impression of looking through a window at a picture somewhat like that of a television receiver. To generate the picture, the computer graphics system selects content from basic forms (primitives), orients the selected forms with respect to a window, accounts for hidden surfaces then displays a composed image on a viewing screen.
According to one technique, picture content is developed from primitives as polygons, e.g. triangles and lines. The polygons define outlines or solid areas of gray or color and are joined along with lines to form an object or a part of an object in the desired display. Typically, the polygons and lines are mathematically defined in three-dimensional, world space. Basic practice then involves orienting polygons and lines with respect to a viewpoint, scanning the primitives to define data for small, individual picture elements (pixels). Hidden-surface representations are selectively calculated, then the pixel representations are displayed, typically in a raster pattern to provide an image on a two-dimensional screen.
Essentially, the scan conversion of a polygon or line involves finding all the pixels that lie within the influence of such representations then setting the color and intensity contribution for each such pixel. In a typical display, a million pixels may be employed to compose a picture.
In accordance with conventional computer graphics techniques, a picture image is stored as a pattern of binary, digital numbers that represent individual pixels in a rectangular array. The numerical data representations of individual pixels are supplied in sequence to a cathode ray tube apparatus as the tube screen is scanned in a raster pattern to display the pixels sequentially in the rectangular array. Accordingly, the pixels are presented in a raster pattern as a succession of scan lines, each of which consists of a row of pixels. The raster scan is most familiar in the television displays.
Of course, objects of display in a computer graphics image seldom have the convenient shape of a geometric primitive. However, objects are decomposed into planar polygons and may be decomposed into triangular polygons for processing in accordance with well known techniques utilizing apparatus of the prior art. For some displays, lines also are used in the simulation of objects. While the technique of defining triangular polygons and lines to compose a picture is effective, the basic display appears unrealistic. For one thing, it is desirable for images to be smoothly shaded as by shading the representative polygons and lines. The technique of shading polygons is well known and is illustrated and described in a book entitled, Principles of Interactive Computer Graphics, Second Edition, Newman and Sproull, McGraw-Hill Book Company, 1979.
Various specific shading techniques are well known and used in the prior art; and in that regard, the referenced book describes both Gouraud and Phong shading techniques. Essentially, shading involves defining intensities at reference locations of a polygon and interpolating to shade the spaces in between. Similar techniques may be employed to impart texture to objects. Specifically, texturing techniques are described in the above-referenced book, Principles of Interactive Computer Graphics, referenced above, in a section beginning on page 407.
In the processing of primitives or polygons, space is defined in different coordinate systems in relation to reference points. Traditionally, polygons have been interpolated in screen space; however, such interpolation has been recognized as erroneous and deters from the quality of a displayed image. In that regard, a patent application, Ser. No. 07/758,992, "System for Polygon Interpolation Using Instantaneous Values in a Variable" is based on the recognition that considerably improved displays can be accomplished by interpolation in a space that is not subject to nonlinear distortion, e.g. world space. Accordingly, computer graphics images can be significantly improved.
Generally, in accordance with the present invention, it has been discovered that techniques used for the interpolation of polygons, e.g. triangles, also can be effectively adapted for the interpolation of lines. Specifically, in accordance with the present invention, a system has been developed for effectively shading lines as well as polygons as reflected in data for computer graphics images. The discovery involves adapting triangle interpolation techniques to lines thereby affording an effective sub-system for interpolating both triangles and lines. Generally, for interpolation, lines are treated as a triangle edge accommodating shading or other interpolations as by techniques utilizing barycentric coordinates.
The system of the present invention may be implemented conveniently in a graphics system incorporating techniques for barycentric interpolation as described in the referenced patent application. However, in any event, the system of the present invention may be implemented by a process of constructing a triangle from the endpoints of a line. One method is to move perpendicular to the line a distance of one-half the line length beginning at the midpoint of the line. Note that the factor of one-half is somewhat arbitrary; however, it does result in an isosceles triangle with an effective aspect ratio for the interpolation.
Utilizing the constructed triangle, the line is treated as an edge to accomplish interpolation, and accordingly to shade the line. In that regard, sample points for pixels that are contiguous to the line (triangle edge) receive a contribution from the line. Sample points may be coerced to the line to attain a contribution. Also, the edges of a triangle are treated as lines if the pixel in process falls outside the edge.